package com.ziyun.pop.mall.module.goods.web;

import com.alibaba.fastjson.JSONObject;
import com.service.goods.constant.GoodsResult;
import com.service.goods.model.goods.GoodsParamsVO;
import com.ziyun.pop.mall.module.goods.service.PopGoodsService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * POP商品Controller
 * @Author:chenxiaoyi
 * @Date:2018/9/7 11:45
 */
@Api(value ="POP商品Controller")
@Controller
public class PopGoodsController {

    private static Logger _log = LoggerFactory.getLogger(PopGoodsController.class);
    private static final String MODEL = "/goods";

    @Autowired
    private PopGoodsService popGoodsService;

    //根据选项参数，获取价格详情
    @PostMapping(MODEL+"/getSellPrice.json")
    @ResponseBody
    public GoodsResult<?> getSellPrice(String goodsParamsVO){
        GoodsParamsVO paramsVO = JSONObject.parseObject(goodsParamsVO, GoodsParamsVO.class);
        return  popGoodsService.getSellPrice(paramsVO);
    }

}
